package com.jueling.culture.service.impl;

import com.jueling.culture.mapper.CustUserInfoMapper;
import com.jueling.culture.model.CustUser;
import com.jueling.culture.service.CustUserInfoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author linp
 * @create 2022/4/11 15:38
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CustUserInfoServiceImpl implements CustUserInfoService {

    @Resource
    private CustUserInfoMapper custUserInfoMapper;

    /**
     * 查询代理人链路信息
     *
     * @param custId
     * @return
     */
    @Override
    public CustUser getCustUserInfoByCustID(String custId) {
        return custUserInfoMapper.getCustUserInfoByCustID(custId);
    }

    /**
     * 保存代理人链路信息
     *
     * @param custUser
     */
    @Override
    public void saveCustUserInfo(CustUser custUser) {
        custUserInfoMapper.saveCustUserInfo(custUser);
    }

    /**
     * 根据代理ID查询上下级代理人列表
     *
     * @param custId
     * @return
     */
    @Override
    public List<CustUser> selectCustUserAll(String custId,String levels) {
        return custUserInfoMapper.selectCustUserAll(custId,levels);
    }

    /**
     * 移除所有代理信息
     *
     * @param custId
     */
    @Override
    public void removeCustUser(String custId) {
        custUserInfoMapper.removeCustUser(custId);
    }

    /**
     * 批量更新代理链路
     *
     * @param custUserList
     */
    @Override
    public void insertCustUserList(List<CustUser> custUserList) {
        custUserInfoMapper.insertCustUserList(custUserList);
    }

    /**
     * 删除所有数据
     */
    @Override
    public void deleteAll() {
        custUserInfoMapper.deleteAll();
    }
}
